<div class="row" ng-controller="UserCtrl">
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <strong>
                    <div ng-show="id">
                        修改用户信息
                    </div>
                    <div ng-hide="id">
                        添加用户
                    </div>
                </strong>
            </div>

            <div class="panel-body">
                <form class="form-horizontal" role="form" ng-submit="createOrUpdateUser()">
                    <div class="form-group" ng-show="error_msg">
                        <div class="col-sm-offset-1 col-sm-11">
                            <div class="alert alert-danger" role="alert">{{error_msg}}</div>
                        </div>
                    </div>

                    <input type="hidden" class="form-control" id="id" ng-model="id">

                    <div class="form-group span6">
                        <label for="username" class="col-sm-2 col-sm-offset-2 control-label">用户名</label>
                        <div class="col-sm-4">
                            <input type="text" required="true"  class="form-control" id="username" placeholder="用户名" ng-model="username">
                        </div>
                    </div>

                    <div class="form-group span6">
                        <label for="realname" class="col-sm-2  col-sm-offset-2 control-label">真实姓名</label>
                        <div class="col-sm-4">
                            <input type="text" required="true"  class="form-control" id="realname" placeholder="输入真实姓名" ng-model="realname">
                        </div>
                    </div>

                    <div class="form-group" ng-hide="id">
                        <label for="role" class="col-sm-2  col-sm-offset-2 control-label">角色</label>
                        <div class="col-sm-4 ">
                            <select ng-model="role" ng-change="rolechange(role)" class="form-control" id = "role" ng-options="item.code as item.desc for item in roles">
                                <option value="">请选择角色</option>
                            </select>
                        </div>
                    </div>
                    <div id="hospital_field" class="hidden">
                        <div class="form-group">
                            <label for="hospital.province" class="col-sm-2  col-sm-offset-2 control-label">所属省份</label>

                            <div class="col-sm-4 ">
                                <select ng-model="province"
                                        ng-change="provinceChanged(province)"
                                        class="form-control" id="hospital.province"
                                        ng-options="item._id as item.name for item in provinces">
                                    <option value="">请选择省份</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="hospital" class="col-sm-2  col-sm-offset-2 control-label">所属医院</label>

                            <div class="col-sm-4 ">
                                <select ng-model="hospital" class="form-control" id="hospital"
                                        ng-options="item._id as item.name for item in hospitals">
                                    <option value="">请选择医院</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="email" class="col-sm-2  col-sm-offset-2 control-label">邮件</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="email" placeholder="输入你常用的邮箱地址" ng-model="email">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="phone" class="col-sm-2  col-sm-offset-2 control-label">联系电话</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="phone" placeholder="输入你的联系电话" ng-model="phone">
                        </div>
                    </div>

                    <div class="form-actions">
                        <button type="submit" class="btn btn-default col-sm-offset-4 col-sm-1">确定</button>
                        <button type="button" class="btn col-sm-1 cancel_btn" ng-click="cancel()">取消</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>